package com.kotlin.flong.oop_fp

//类的委托

fun main(args: Array<String>) {
    val son = SonFather1(BigSon())
    son.wash()
}


interface WashPower1 {

    //洗碗的行为
    fun wash()


}

class BigSon : WashPower1 {
    override fun wash() {
        println("儿子开始洗碗")
    }
}

// 只有有洗碗的能力都委托给他
class SonFather1(var wash: WashPower1) : WashPower1 by wash {


    override fun wash() {

        println("给儿子一块钱")
        wash.wash()

        println("继续")

    }
}
